package com.minimalist.common.feign.client.lindi;

import com.minimalist.common.config.mybatis.bo.PageResp;
import com.minimalist.common.entity.lindi.vo.provinceindex.LindiProvinceIndexQueryVO;
import com.minimalist.common.entity.lindi.vo.provinceindex.LindiProvinceIndexVO;
import com.minimalist.common.feign.config.FeignConfig;
import com.minimalist.common.feign.fallback.lindi.LindiProvinceIndexFeignClientFallbackFactory;
import com.minimalist.common.response.R;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import jakarta.validation.constraints.NotNull;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 林地省级指标 Feign 客户端
 *
 * @author 11987
 */
@FeignClient(name = "minimalist-lindi"
        , contextId = "lindiProvinceIndexFeignClient"
        , path = "/minimalist/lindi/provinceIndex"
        , configuration = FeignConfig.class
        , fallbackFactory = LindiProvinceIndexFeignClientFallbackFactory.class)
public interface LindiProvinceIndexFeignClient{
    /**
     * 添加省级指标
     *
     * @param indexVO 省级指标信息
     * @return 成功或失败
     */
    @PostMapping("/addProvinceIndex")
    @Operation(summary = "添加省级指标")
    R<?> addProvinceIndex(@RequestBody @Validated(Add.class) LindiProvinceIndexVO indexVO);

    /**
     * 删除省级指标 -> 根据省级指标ID删除
     *
     * @param provinceIndexId 省级指标ID
     * @return 成功或失败
     */
    @DeleteMapping("/deleteProvinceIndexByProvinceIndexId")
    @Operation(summary = "删除省级指标 -> 根据省级指标ID删除")
    R<?> deleteProvinceIndexByProvinceIndexId(
            @RequestParam("provinceIndexId")
            @NotNull(message = "省级指标ID不能为空")
            @Parameter(name = "provinceIndexId", required = true, description = "省级指标ID")
            Long provinceIndexId);

    /**
     * 修改省级指标
     *
     * @param indexVO 省级指标信息
     * @return 成功或失败
     */
    @PutMapping("/updateProvinceIndexByProvinceIndexId")
    @Operation(summary = "修改省级指标")
    R<?> updateProvinceIndexByProvinceIndexId(
            @RequestBody @Validated(Update.class) LindiProvinceIndexVO indexVO);

    /**
     * 查询省级指标列表(分页)
     *
     * @param queryVO 查询条件
     * @return 省级指标列表
     */
    @GetMapping("/getPageProvinceIndexList")
    @Operation(summary = "查询省级指标列表(分页)")
    R<PageResp<LindiProvinceIndexVO>> getPageProvinceIndexList(
            LindiProvinceIndexQueryVO queryVO);

    /**
     * 根据省级指标ID查询省级指标
     *
     * @param provinceIndexId 省级指标ID
     * @return 省级指标
     */
    @GetMapping("/getProvinceIndexByProvinceIndexId/{provinceIndexId}")
    @Operation(summary = "根据省级指标ID查询省级指标")
    R<LindiProvinceIndexVO> getProvinceIndexByProvinceIndexId(
            @PathVariable(value = "provinceIndexId")
            @NotNull(message = "省级指标ID不能为空")
            @Parameter(name = "provinceIndexId", description = "省级指标ID", required = true)
            Long provinceIndexId);
}